/*
 *Copyright (c) 2024 Black Sesame Technologies
 *
 *Licensed under the Apache License, Version 2.0 (the "License");
 *you may not use this file except in compliance with the License.
 *You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 *Unless required by applicable law or agreed to in writing, software
 *distributed under the License is distributed on an "AS IS" BASIS,
 *WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *See the License for the specific language governing permissions and
 *limitations under the License.
*/


#ifndef _TPYES_H
#define _TPYES_H

#ifndef NULL
#define NULL (void*)0
#endif

#ifndef NULL_PTR
#define NULL_PTR (void*)0
#endif

#ifndef STD_HIGH  
    #define STD_HIGH 1U
#endif

#ifndef STD_LOW  
    #define STD_LOW 0U
#endif

#define E_OK 0x00
#define E_NOT_OK 0x01
#define E_BUSY 0x02
#define E_RET 0x03

#ifndef TRUE                                             /* conditional check */
    #define TRUE    1U
#endif
            
#ifndef FALSE                                            /* conditional check */
    #define FALSE    0U
#endif

#ifndef _SIZE_T
#define _SIZE_T
typedef unsigned int size_t;
#endif  /* _SIZE_T */

//#define u32 uint32_t
typedef unsigned int u32;
typedef unsigned char u8;
typedef unsigned short u16;
typedef unsigned long long u64;

typedef int s32;
typedef char s8;
typedef short s16;
typedef long long s64;
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
// typedef unsigned int uint32_t;
// typedef int int32_t;
typedef short int16_t;
// typedef char int8_t;

typedef unsigned char       boolean;        /* for use with TRUE/FALSE        */
typedef signed char         sint8;          /*      -128 .. +127            */
typedef unsigned char       uint8;          /*           0 .. 255             */
typedef signed short        sint16;         /*      -32768 .. +32767          */
typedef unsigned short      uint16;         /*           0 .. 65535           */ 
typedef signed int          sint32;         /* -2147483648 .. +2147483647     */
typedef unsigned int        uint32;         /*           0 .. 4294967295      */
typedef unsigned long long  uint64;
typedef float               float32;                
typedef double              float64;

#ifndef __iomem
#define __iomem
#endif
#ifdef __cplusplus
  #define   __I     volatile             /*!< Defines 'read only' permissions                 */
#else
  #define   __I     volatile const       /*!< Defines 'read only' permissions                 */
#endif
#define     __O     volatile             /*!< Defines 'write only' permissions */
#define     __IO    volatile             /*!< Defines 'read / write' permissions */


typedef signed char __s8;
typedef unsigned char __u8;

typedef signed short __s16;
typedef unsigned short __u16;

typedef signed int __s32;
typedef unsigned int __u32;

/* As on Linux.  Works for both platforms, i686 and x86_64. */
typedef signed long long __s64;
typedef unsigned long long __u64;


#ifdef CONFIG_PHYS_ADDR_T_64BIT
typedef __u64 phys_addr_t;
#else
typedef __u32 phys_addr_t;
#endif

typedef enum { false, true }bool;

#ifndef BIT
    #define BIT(x)  (1UL << (x))
#endif

typedef enum{
    HVTE_FALSE,
    HVTE_TRUE,
}bool_enum;

/*! @brief Computes the number of elements in an array. */
#if !defined(ARRAY_SIZE)
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
#endif

// # define assert(__e) ((void)0)


typedef void (*breset_call)(void);
typedef u32 (*funcp)(u32 flags, void *para);

typedef struct _test_struct{
    funcp fp;
    u32 flags;
    void *para;
    char *name;
    char *description;
}test_struct;

typedef struct _test_static{
    u32 total_test_case;
    u32 total_pass_case;
    u32 total_fail_case;
    u32 total_test_ip;
    u32 total_pass_ip;
    u32 total_fail_ip;
    u32 po_fail_flag; //power on test fail flag
    u32 ip_fail_flag;
}test_static;

#endif /* _TPYES_H */
